import pygame
import os

def generate_pokemon(image_num):
    """根据图片编号生成对应的宝可梦实例
    
    参数:
        image_num: 图片编号(3-6)
        
    返回:
        Pokemon实例
    """
    # 基础属性配置
    pokemon_data = {
        3: {"name": "妙蛙种子", "hp": 120, "skills": [
            {"name": "藤鞭", "damage": 12, "effect": None},
            {"name": "寄生种子", "damage": 6, "effect": "leech"},
            {"name": "生长", "damage": 0, "effect": "attack_up"},
            {"name": "飞叶快刀", "damage": 18, "effect": None}
        ]},
        4: {"name": "小火龙", "hp": 100, "skills": [
            {"name": "火花", "damage": 15, "effect": None},
            {"name": "烟幕", "damage": 0, "effect": "accuracy_down"},
            {"name": "火焰漩涡", "damage": 10, "effect": "burn"},
            {"name": "喷射火焰", "damage": 20, "effect": None}
        ]},
        5: {"name": "杰尼龟", "hp": 130, "skills": [
            {"name": "水枪", "damage": 12, "effect": None},
            {"name": "缩壳", "damage": 0, "effect": "defense_up"},
            {"name": "泡沫光线", "damage": 14, "effect": "speed_down"},
            {"name": "水炮", "damage": 22, "effect": None}
        ]},
        6: {"name": "皮卡丘", "hp": 90, "skills": [
            {"name": "电击", "damage": 10, "effect": None},
            {"name": "电磁波", "damage": 0, "effect": "paralyze"},
            {"name": "电光一闪", "damage": 8, "effect": None},
            {"name": "十万伏特", "damage": 25, "effect": None}
        ]}
    }
    
    if image_num not in pokemon_data:
        raise ValueError("不支持的宝可梦编号，请输入3-6之间的数字")
        
    data = pokemon_data[image_num]
    image_path = f"{image_num}.png"
    
    # 创建宝可梦实例
    pokemon = type('Pokemon', (), {
        "name": data["name"],
        "max_hp": data["hp"],
        "current_hp": data["hp"],
        "image": pygame.image.load(os.path.join("image", image_path)),
        "skills": data["skills"],
        
        "use_skill": lambda self, skill_index, target, battle_info: None,
        "take_damage": lambda self, amount, battle_info: None,
        "heal": lambda self, amount: None
    })()
    
    return pokemon
